package cn.edu.jxyy.p5;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

 public class MyInvocationHandler implements InvocationHandler {
    private IFlower flower;
    public MyInvocationHandler(IFlower flower) {
        this.flower = flower;
    }
    @Override
    public Object invoke(Object proxy,
                         Method method, Object[] args) throws Throwable {
        System.out.println("do something before");
        Object invoke = method.invoke(flower, args);
        System.out.println("do something after");
        return invoke;
    }
}
